using System;
using System.Collections.Generic;
using DMS.BEs;

namespace ObjectFactories {
	public class MediaTypeFactory {

		private readonly MediaType[] items = new MediaType[6];
		private static MediaTypeFactory instance;

		private MediaTypeFactory() {
			items[1] = new MediaType {Name = "MPEG audio file"};
			items[2] = new MediaType {Name = "Protected AAC audio file"};
			items[3] = new MediaType {Name = "Protected MPEG-4 video file"};
			items[4] = new MediaType {Name = "Purchased AAC audio file"};
			items[5] = new MediaType {Name = "AAC audio file"};
		}

		static public void Reset() {
			instance=null;
		}

		static public MediaTypeFactory GetInstance() {
			if (instance==null) instance = new MediaTypeFactory();
		return instance;
		}

		static public IList<MediaType> GetAll() {
			return GetInstance().items;
		}

		static public MediaType GetByOriginalId(int? id)
		{
			return id.HasValue ? GetInstance().items[id.Value] : null;
		}
	}
}
